<div class="container">
  <h1>_make_sure_allowed()</h1>
  <p class="signature">public function _make_sure_allowed(): ?string</p>

  <h2>Description</h2>
  <div class="description">
    <p>
      Ensures that access is allowed for administrators by verifying the presence of a valid token. If the user is not logged in or lacks the required token, they are redirected to the Trongate administrators' login page.
    </p>
    <p>
      If accessed in development mode (ENV == 'dev') without a valid token, a token is automatically generated for the first Trongate administrator record.
    </p>
  </div>
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
        <th>Default</th>
        <th>Required</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td colspan="5">This method does not take any parameters.</td>
      </tr>
    </tbody>
  </table>

  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>string|null</td>
        <td>Returns a token consisting of 32 alphanumeric characters (including uppercase letters, lowercase letters and digits) if access is granted.  If access is not granted the method returns null and redirects to the login page for adminstrators.</td>
      </tr>
    </tbody>
  </table>

  <h2>Example Usage</h2>
  <p>This method is typically accessed via the <b>Trongate_security</b> module using code similar to the following:</p>
  <pre>$this->module('trongate_security');
$token = $this->trongate_security->_make_sure_allowed();</pre>
</div>